<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../node_modules/vue/dist/vue.global.js"></script>
</head>

<body>
    <div id="app">
        <part1>
            <template v-slot="slotProps">
                <ul>
                    <li v-for="item in slotProps.nameArr" :key="item.id">
                        {{item.name}}
                    </li>
                </ul>
            </template>
        </part1>
    </div>
</body>

</html>
<script>
    // 作用域插槽: 
    // 说白了 也就组件传值的一种方式, 将子组件的数据传递父组件,


    const app = Vue.createApp({
        data() {
            return {

            }
        },
        methods: {

        },
        components: {
            part1: {
                template: `
                    <div>
                        <p>我是局部组件</p>
                        <slot :name-arr='nameArr' tit='哈哈哈哈'></slot>
                    </div>
                `,
                data() {
                    return {
                        nameArr: [
                            {
                                id: 1,
                                name: '漩涡-鸣人',
                            },
                            {
                                id: 2,
                                name: '宇智波-佐助',
                            },
                            {
                                id: 3,
                                name: '黄色闪光-鸣人爹',
                            }
                        ]
                    }
                }
            }
        }
    }).mount('#app')

</script>